import dayjs from "dayjs";
import { encryptByBase64DesEcbPkcs7 } from "./cryptoJs";

const secretKey = "sanmao2015!@##EDC";

/**
 * 获取auth
 */
export const getAuth = (key?: string) => {
  const params = {
    package_name: "sanmaoyou_h5",
    time: dayjs().unix(),
  };
  return encryptByBase64DesEcbPkcs7(JSON.stringify(params), key || secretKey);
};

/**
 * 获取cpl
 */
export const getCpl = (key?: string) => {
  const params = { app: "sanmaoyou_h5" };
  return encryptByBase64DesEcbPkcs7(JSON.stringify(params), key || secretKey);
};
